#include "Utils.h"


Cfg::Cfg(void)
{
}


Cfg::~Cfg(void)
{
}
static Cfg* cfgInstance = NULL;
Cfg* Cfg::shareCfg(){
	if(cfgInstance == NULL){
		cfgInstance = new Cfg();
	}
	return cfgInstance;
}

WallPool::WallPool()
{
	map = CCDictionary::create();
	map->retain();
}

WallPool::~WallPool()
{
	map->release();
}
static WallPool* wallPool = NULL;
WallPool* WallPool::sharePool(){
	if(wallPool == NULL){
		wallPool = new WallPool();
		wallPool->retain();
	}
	return wallPool;
}
void WallPool::recycleWall(CCPhysicsSprite* node){
	CCString* key = (CCString*)node->getUserObject();
	CCArray* arr = (CCArray*) map->objectForKey(key->getCString());
	if(arr == NULL){
		arr = CCArray::createWithCapacity(2);
		map->setObject(arr,key->getCString());
	}
	arr->addObject(node);
	node->setVisible(false);
}
CCPhysicsSprite* WallPool::getWall(const char* name){
	CCArray* arr = (CCArray*) map->objectForKey(name);
	CCPhysicsSprite* sp = NULL;
	if(arr != NULL && arr->count()>0){
		sp = (CCPhysicsSprite*) arr->objectAtIndex(0);
		sp->setVisible(true);
	}
	return sp;
}